package edu.mse.camel.client.whiteboard.gef.ui.editor;

import java.util.Map;

import org.eclipse.emf.ecore.EPackage;


import edu.mse.camel.client.whiteboard.gef.whiteboard.WhiteboardFactory;
import edu.mse.camel.client.whiteboard.gef.whiteboard.impl.WhiteboardPackageImpl;

public class WhiteboardModelManager {

	private static WhiteboardFactory factory = getFactory();

	/**
	 * Returns the factory associated with the model. Object creation is made
	 * through that factory.
	 */
	public static WhiteboardFactory getFactory() {
		if (factory == null) {
			WhiteboardPackageImpl.init();
			// Access the factory (needed to create instances)
			Map registry = EPackage.Registry.INSTANCE;
			String URI = WhiteboardPackageImpl.eNS_URI;
			WhiteboardPackageImpl wbPackage = 
							(WhiteboardPackageImpl) registry.get(URI);
			factory = wbPackage.getWhiteboardFactory();
		}
		return factory;
	}

}
